home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 5
/
Aminet 5 - March 1995.iso
/
Guides
/
PicsData
/
Rexx
/
PZ_MakeThumbNail.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1995-01-14
|
2KB
|
131 lines
/*
** $VER: $Id: PZ_MakeThumbNail.rexx,v 5.0 1993/11/12 01:16:07 chris Exp $
** Copyright (C) 1992, 1993 by Christian A. Weber, Zürich, Switzerland.
**
** Creates a thumbnail picture for later use by MakeContact.rexx.
**
** You may wish to change MAXMEM for ADPro if you don't have enough RAM,
** and the delay after loading if you have a slow HD :)
*/
options results
arg adprodir inname text maxwidth maxheight outname
address 'ADPro'
/*
** Make sure ADPro is running
*/
IF ~show(ports,'ADPro') THEN
DO
Address COMMAND 'C:Assign ADPRO: '||adprodir
Address COMMAND 'Run >NIL: ADPRO:ADPro MAXMEM=5000000 BEHIND'
Address COMMAND 'C:Wait 5'
IF ~show(ports,'ADPro') THEN EXIT
END
/*
** Screen types for ADPro
*/
LORES = 0
HIRES = 1
LACE = 2
PAL = 4
XOVERSCAN = 8
YOVERSCAN = 16
HIRESBIT = 0
LACEBIT = 1
/*
** Adjust for text and borders
*/
maxwidth = maxwidth - 2
maxheight = maxheight - 18
/*
** Now load the picture ...
*/
LFORMAT 'UNIVERSAL'
LOAD inname
IF RC == 0 THEN DO
/*
** Get the picture size
*/
XSIZE
origwidth = ADPRO_RESULT
YSIZE
origheight = ADPRO_RESULT
IF origwidth > origheight THEN DO
width = maxwidth
height = (origheight * maxwidth) / origwidth
END
ELSE DO
width = (origwidth * maxheight) / origheight
height = maxheight
END
/*
** Make sure we get the best dynamic range
*/
OPERATOR DYNAMIC_RANGE 0 255
/*
** Now we scale the image to width/height
*/
ABS_SCALE width height
/*
** Now save the image
*/
SFORMAT 'IFF'
SAVE outname RAW
/*
** Create a backdrop with room for the text
*/
LFORMAT BACKDROP
LOAD dummy maxwidth+2 maxheight+18 COLOR 60 40 60
OPERATOR RECTANGLE 0 0 maxwidth+2 maxheight+18 1 255 235 245 100
/*
** Load the image under the text
*/
LFORMAT 'UNIVERSAL'
LOAD outname 1 17 100 0 0 0
/*
** Render the text
*/
OPERATOR TEXT_VISUAL RENDER_TYPE MIX FONT_NAME topaz.font SET_FONT_SIZE 11 SET_COLORS 255 255 255 SET_SATURATION 100 SET_TINT 100 STRING text CENTER_XOFFSET SET_YOFFSET 3 DRAW
/*
** Now save the image again
*/
SFORMAT 'IFF'
SAVE outname RAW
END
ELSE DO
/*
** LOAD returned an error
*/
say filename || ': not a picture'
END